#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
    int num = 0;
    int max = 0;
    int min = 100;
    scanf("%d", &num);
    int arr[10] = { 0 };
    int i = 0;
    for (i = 0; i < num; i++)
    {
        scanf("%d", &arr[i]);
    }
    for (i = 0; i < num; i++)
    {
        if (arr[i] >= max)
        {
            max = arr[i];
        }
        else if (arr[i] < min)
        {
            min = arr[i];
        }
    }
    if (min >= max)
    {
        min = arr[i];
    }
    printf("%d", max - min);
    return 0;
}